<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>BrokenIRC: server_src/server_main.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">BrokenIRC
   &#160;<span id="projectnumber">0.0.42</span>
   </div>
   <div id="projectbrief">A &#39;not so functionnal&#39; irc server and a WIP client</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_20e5c1c74b8b955148e6b35ac4a0bc4d.html">server_src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">server_main.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="server__main_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">** EPITECH PROJECT, 2018</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">** MY_IRC</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">** File description:</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">** my_irc server source file</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">*/</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;../include/server.h&quot;</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;unistd.h&gt;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;sys/wait.h&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;arpa/inet.h&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;regex.h&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="server__main_8c.html#a01aa22f887842d97133af9b3f2cf4a7c">   20</a></span>&#160;<span class="keyword">static</span> <span class="keywordtype">int</span>      <a class="code" href="server__main_8c.html#a01aa22f887842d97133af9b3f2cf4a7c">initco</a>(<a class="code" href="structt__serv.html">t_serv</a> *all, <span class="keywordtype">char</span> **args, <span class="keywordtype">int</span> *connected)</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;{</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        <span class="keywordtype">int</span> rt = 84;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;        <span class="keyword">struct </span>sockaddr_in addr;</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;        socklen_t addr_size = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>sockaddr_in);</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;        <span class="keyword">struct </span>sockaddr *cliaddr = (<span class="keyword">struct </span>sockaddr *)&amp;addr;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;        <span class="keywordtype">char</span> *okco = <span class="stringliteral">&quot;Someone connect to me!\n&quot;</span>;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;        all-&gt;<a class="code" href="structt__serv.html#a5c3a4553e608f252da1d211b20b459ec">conn_sock</a> = accept(all-&gt;<a class="code" href="structt__serv.html#ac9f24d41d8822f2c1b7df4362e18cad9">listen_sock</a>, cliaddr, &amp;addr_size);</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;        <span class="keywordflow">if</span> (all-&gt;<a class="code" href="structt__serv.html#a5c3a4553e608f252da1d211b20b459ec">conn_sock</a> == -1) {</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;                perror(<span class="stringliteral">&quot;initco: accept&quot;</span>);</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!(rt = <a class="code" href="server__init_8c.html#aa9bc3ff8e7f409540f85b3cc97636500">set_clifd</a>(all-&gt;<a class="code" href="structt__serv.html#a5c3a4553e608f252da1d211b20b459ec">conn_sock</a>, all-&gt;<a class="code" href="structt__serv.html#a46bee037324e9deec26f15fbc4f6d8e5">epollfd</a>, &amp;all-&gt;<a class="code" href="structt__serv.html#aa95442079d9e7a2294ad8df1335ae0f4">ev</a>))) {</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;                fprintf(stdout, <span class="stringliteral">&quot;\n%s: %s\n&quot;</span>, args[0], okco);</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                *(connected) += 1;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;        }</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;        <span class="keywordflow">return</span> (rt);</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;}</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="server__main_8c.html#a4178685c6a99dba7611faf9fe58f1a54">   43</a></span>&#160;<span class="keyword">static</span> <span class="keywordtype">int</span>      <a class="code" href="server__main_8c.html#a4178685c6a99dba7611faf9fe58f1a54">evhandler</a>(<a class="code" href="structt__serv.html">t_serv</a> *all, <span class="keywordtype">int</span> newfd)</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;{</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        <span class="keyword">struct </span>sockaddr_in addr;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        socklen_t addr_size = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>sockaddr_in);</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        <span class="keywordtype">int</span> res = getpeername(newfd, (<span class="keyword">struct</span> sockaddr *)&amp;addr, &amp;addr_size);</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;                perror(<span class="stringliteral">&quot;evhandler: getpeername&quot;</span>);</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;                sprintf(all-&gt;<a class="code" href="structt__serv.html#a0dd3a9c2648da4fba88a38276803037c">host</a>, <span class="stringliteral">&quot;%s&quot;</span>, inet_ntoa(addr.sin_addr));</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;                sprintf(all-&gt;<a class="code" href="structt__serv.html#aee509c3823199bf9f0ad285a718260bd">service</a>, <span class="stringliteral">&quot;%d&quot;</span>, ntohs(addr.sin_port));</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;                <span class="keywordflow">if</span> (all-&gt;<a class="code" href="structt__serv.html#a85e55e3fe1bfb973e7f5d15a0a436b18">nread</a> &amp;&amp; <a class="code" href="logs__helpers_8c.html#a7e2903ce4461ed71cf294dd675bd4c49">logthisevent</a>(<span class="charliteral">&#39;c&#39;</span>, all)) {</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;                        <a class="code" href="commands__parsing_8c.html#ac5949d17278df5e1ada98dca25ccd961">get_methods</a>(all-&gt;<a class="code" href="structt__serv.html#a005714cf56aaffce970916774cf2b04a">buf</a>, newfd);</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;                } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;                        <a class="code" href="logs__helpers_8c.html#a7e2903ce4461ed71cf294dd675bd4c49">logthisevent</a>(<span class="charliteral">&#39;d&#39;</span>, all);</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                }</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        }</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        <span class="keywordflow">return</span> (0);</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;}</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="server__main_8c.html#a825c9cedc1751b000c44487b4233c37c">   74</a></span>&#160;<span class="keyword">static</span> <span class="keywordtype">int</span>      <a class="code" href="server__main_8c.html#a825c9cedc1751b000c44487b4233c37c">getactiveclients</a>(<a class="code" href="structt__serv.html">t_serv</a> *all, <span class="keywordtype">char</span> **args)</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;{</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <span class="keywordtype">int</span> clifd = -1;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        <span class="keyword">static</span> <span class="keywordtype">int</span> connected;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> n = 0; n &lt; all-&gt;<a class="code" href="structt__serv.html#a7659da4b3744e6ddd8f77f37d2138914">nfds</a>; ++n) {</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;                clifd = all-&gt;<a class="code" href="structt__serv.html#a3c6f3b16eed7e8c35eb4d2831583ea15">events</a>[n].data.fd;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;                <span class="keywordflow">if</span> (clifd == all-&gt;<a class="code" href="structt__serv.html#ac9f24d41d8822f2c1b7df4362e18cad9">listen_sock</a>) {</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                        <a class="code" href="server__main_8c.html#a01aa22f887842d97133af9b3f2cf4a7c">initco</a>(all, args, &amp;connected);</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;                        memset(all-&gt;<a class="code" href="structt__serv.html#a005714cf56aaffce970916774cf2b04a">buf</a>, 0, <a class="code" href="server_8h.html#a6821bafc3c88dfb2e433a095df9940c6">BUF_SIZE</a>);</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                        all-&gt;<a class="code" href="structt__serv.html#a85e55e3fe1bfb973e7f5d15a0a436b18">nread</a> = read(clifd, all-&gt;<a class="code" href="structt__serv.html#a005714cf56aaffce970916774cf2b04a">buf</a>, <a class="code" href="server_8h.html#a6821bafc3c88dfb2e433a095df9940c6">BUF_SIZE</a>);</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;                        <a class="code" href="server__main_8c.html#a4178685c6a99dba7611faf9fe58f1a54">evhandler</a>(all, clifd);</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                        memset(all-&gt;<a class="code" href="structt__serv.html#a005714cf56aaffce970916774cf2b04a">buf</a>, 0, <a class="code" href="server_8h.html#a6821bafc3c88dfb2e433a095df9940c6">BUF_SIZE</a>);</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;                }</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        }</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keywordflow">return</span> (0);</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;}</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="server__main_8c.html#af3e041546aaed3cd242c2b0e77162b39">   96</a></span>&#160;<span class="keywordtype">int</span>     <a class="code" href="server__main_8c.html#af3e041546aaed3cd242c2b0e77162b39">server</a>(<span class="keywordtype">char</span> **args)</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;{</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="keywordtype">int</span> rt = 0;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        <a class="code" href="structt__serv.html">t_serv</a> all;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        <a class="code" href="server__init_8c.html#a3802a71fa34e93cb1d85f919914f5abf">set_iface</a>(&amp;all.<a class="code" href="structt__serv.html#a71d55fd97c2ffc84c72b17820396cdff">hints</a>, &amp;all.<a class="code" href="structt__serv.html#ae8783e38ef0c183366703267ca7b3298">res</a>, args[1]);</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        all.<a class="code" href="structt__serv.html#ac9f24d41d8822f2c1b7df4362e18cad9">listen_sock</a> = <a class="code" href="server__init_8c.html#a1f61d16ccfab82b21ca40ce23feb7c02">set_sockfd</a>(&amp;all);</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        <span class="keywordflow">if</span> (all.<a class="code" href="structt__serv.html#ac9f24d41d8822f2c1b7df4362e18cad9">listen_sock</a> &lt; 0 || <a class="code" href="server__init_8c.html#a5cb15d408ef32c09c2485937503438ed">set_epoll</a>(&amp;all) == -1) {</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;                rt = 84;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;                <span class="keywordflow">for</span> (<a class="code" href="server_8h.html#a2b912ed39df233b43d7a093814705afb">EVER</a>) {</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                        all.<a class="code" href="structt__serv.html#a7659da4b3744e6ddd8f77f37d2138914">nfds</a> = epoll_wait(all.<a class="code" href="structt__serv.html#a46bee037324e9deec26f15fbc4f6d8e5">epollfd</a>, all.<a class="code" href="structt__serv.html#a3c6f3b16eed7e8c35eb4d2831583ea15">events</a>,</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;                                <a class="code" href="server_8h.html#ae42954bb8545d24e3e9dcde5920c9a0b">MAX_EVENTS</a>, -1);</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;                        <span class="keywordflow">if</span> (all.<a class="code" href="structt__serv.html#a7659da4b3744e6ddd8f77f37d2138914">nfds</a> == -1) {</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;                                perror(<span class="stringliteral">&quot;server: epoll_wait&quot;</span>);</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;                                <span class="keywordflow">break</span>;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;                        }</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;                        rt = <a class="code" href="server__main_8c.html#a825c9cedc1751b000c44487b4233c37c">getactiveclients</a>(&amp;all, args);</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;                }</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;                close(all.<a class="code" href="structt__serv.html#ac9f24d41d8822f2c1b7df4362e18cad9">listen_sock</a>);</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        }</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <span class="keywordflow">return</span> (rt);</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;}</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div><div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="server__main_8c.html#a0c99d968a34e803d378692bde2e3f18f">  124</a></span>&#160;<span class="keywordtype">int</span>     <a class="code" href="server__main_8c.html#a0c99d968a34e803d378692bde2e3f18f">main</a>(<span class="keywordtype">int</span> ac, <span class="keywordtype">char</span> **av)</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;{</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        <span class="keywordtype">int</span> rt = 0;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        <span class="keywordtype">char</span> *endptr = NULL;</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;        <span class="keywordtype">char</span> *port = NULL;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <span class="keywordtype">int</span> val = 0;</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        <span class="keywordflow">if</span> (ac == 2) {</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;                port = av[1];</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;                val = strtol(port, &amp;endptr, 10);</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;                signal(SIGINT, <a class="code" href="sig__handler_8c.html#a4f31a6fd48ee5d4579ae4aaaa3cae285">sig_handler</a>);</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;                <span class="keywordflow">if</span> (endptr != port  &amp;&amp; val &gt;= 1024)</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;                        rt = <a class="code" href="server__main_8c.html#af3e041546aaed3cd242c2b0e77162b39">server</a>(av);</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;                <span class="keywordflow">else</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;                        rt = 84;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;                fprintf(stderr, <span class="stringliteral">&quot;%s: [port]\n&quot;</span>, av[0]);</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;                rt = 84;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        }</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        <span class="keywordflow">return</span> (rt);</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;}</div><div class="ttc" id="server__main_8c_html_a01aa22f887842d97133af9b3f2cf4a7c"><div class="ttname"><a href="server__main_8c.html#a01aa22f887842d97133af9b3f2cf4a7c">initco</a></div><div class="ttdeci">static int initco(t_serv *all, char **args, int *connected)</div><div class="ttdef"><b>Definition:</b> <a href="server__main_8c_source.html#l00020">server_main.c:20</a></div></div>
<div class="ttc" id="structt__serv_html_a005714cf56aaffce970916774cf2b04a"><div class="ttname"><a href="structt__serv.html#a005714cf56aaffce970916774cf2b04a">t_serv::buf</a></div><div class="ttdeci">char buf[BUF_SIZE]</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00091">server.h:91</a></div></div>
<div class="ttc" id="structt__serv_html_a0dd3a9c2648da4fba88a38276803037c"><div class="ttname"><a href="structt__serv.html#a0dd3a9c2648da4fba88a38276803037c">t_serv::host</a></div><div class="ttdeci">char host[NI_MAXHOST]</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00092">server.h:92</a></div></div>
<div class="ttc" id="structt__serv_html_a3c6f3b16eed7e8c35eb4d2831583ea15"><div class="ttname"><a href="structt__serv.html#a3c6f3b16eed7e8c35eb4d2831583ea15">t_serv::events</a></div><div class="ttdeci">struct epoll_event events[MAX_EVENTS]</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00098">server.h:98</a></div></div>
<div class="ttc" id="server__main_8c_html_a825c9cedc1751b000c44487b4233c37c"><div class="ttname"><a href="server__main_8c.html#a825c9cedc1751b000c44487b4233c37c">getactiveclients</a></div><div class="ttdeci">static int getactiveclients(t_serv *all, char **args)</div><div class="ttdef"><b>Definition:</b> <a href="server__main_8c_source.html#l00074">server_main.c:74</a></div></div>
<div class="ttc" id="structt__serv_html_a5c3a4553e608f252da1d211b20b459ec"><div class="ttname"><a href="structt__serv.html#a5c3a4553e608f252da1d211b20b459ec">t_serv::conn_sock</a></div><div class="ttdeci">int conn_sock</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00088">server.h:88</a></div></div>
<div class="ttc" id="server__main_8c_html_af3e041546aaed3cd242c2b0e77162b39"><div class="ttname"><a href="server__main_8c.html#af3e041546aaed3cd242c2b0e77162b39">server</a></div><div class="ttdeci">int server(char **args)</div><div class="ttdef"><b>Definition:</b> <a href="server__main_8c_source.html#l00096">server_main.c:96</a></div></div>
<div class="ttc" id="logs__helpers_8c_html_a7e2903ce4461ed71cf294dd675bd4c49"><div class="ttname"><a href="logs__helpers_8c.html#a7e2903ce4461ed71cf294dd675bd4c49">logthisevent</a></div><div class="ttdeci">int logthisevent(const char etype, t_serv *all)</div><div class="ttdef"><b>Definition:</b> <a href="logs__helpers_8c_source.html#l00059">logs_helpers.c:59</a></div></div>
<div class="ttc" id="structt__serv_html_ac9f24d41d8822f2c1b7df4362e18cad9"><div class="ttname"><a href="structt__serv.html#ac9f24d41d8822f2c1b7df4362e18cad9">t_serv::listen_sock</a></div><div class="ttdeci">int listen_sock</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00089">server.h:89</a></div></div>
<div class="ttc" id="structt__serv_html_a46bee037324e9deec26f15fbc4f6d8e5"><div class="ttname"><a href="structt__serv.html#a46bee037324e9deec26f15fbc4f6d8e5">t_serv::epollfd</a></div><div class="ttdeci">int epollfd</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00087">server.h:87</a></div></div>
<div class="ttc" id="server__init_8c_html_a5cb15d408ef32c09c2485937503438ed"><div class="ttname"><a href="server__init_8c.html#a5cb15d408ef32c09c2485937503438ed">set_epoll</a></div><div class="ttdeci">int set_epoll(t_serv *all)</div><div class="ttdef"><b>Definition:</b> <a href="server__init_8c_source.html#l00059">server_init.c:59</a></div></div>
<div class="ttc" id="server__init_8c_html_aa9bc3ff8e7f409540f85b3cc97636500"><div class="ttname"><a href="server__init_8c.html#aa9bc3ff8e7f409540f85b3cc97636500">set_clifd</a></div><div class="ttdeci">int set_clifd(int clisock, int epollfd, struct epoll_event *ev)</div><div class="ttdef"><b>Definition:</b> <a href="server__init_8c_source.html#l00018">server_init.c:18</a></div></div>
<div class="ttc" id="commands__parsing_8c_html_ac5949d17278df5e1ada98dca25ccd961"><div class="ttname"><a href="commands__parsing_8c.html#ac5949d17278df5e1ada98dca25ccd961">get_methods</a></div><div class="ttdeci">int get_methods(char *req, int clifd)</div><div class="ttdef"><b>Definition:</b> <a href="commands__parsing_8c_source.html#l00073">commands_parsing.c:73</a></div></div>
<div class="ttc" id="structt__serv_html"><div class="ttname"><a href="structt__serv.html">t_serv</a></div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00085">server.h:85</a></div></div>
<div class="ttc" id="server__main_8c_html_a0c99d968a34e803d378692bde2e3f18f"><div class="ttname"><a href="server__main_8c.html#a0c99d968a34e803d378692bde2e3f18f">main</a></div><div class="ttdeci">int main(int ac, char **av)</div><div class="ttdef"><b>Definition:</b> <a href="server__main_8c_source.html#l00124">server_main.c:124</a></div></div>
<div class="ttc" id="server_8h_html_ae42954bb8545d24e3e9dcde5920c9a0b"><div class="ttname"><a href="server_8h.html#ae42954bb8545d24e3e9dcde5920c9a0b">MAX_EVENTS</a></div><div class="ttdeci">#define MAX_EVENTS</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00027">server.h:27</a></div></div>
<div class="ttc" id="structt__serv_html_aa95442079d9e7a2294ad8df1335ae0f4"><div class="ttname"><a href="structt__serv.html#aa95442079d9e7a2294ad8df1335ae0f4">t_serv::ev</a></div><div class="ttdeci">struct epoll_event ev</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00097">server.h:97</a></div></div>
<div class="ttc" id="structt__serv_html_a85e55e3fe1bfb973e7f5d15a0a436b18"><div class="ttname"><a href="structt__serv.html#a85e55e3fe1bfb973e7f5d15a0a436b18">t_serv::nread</a></div><div class="ttdeci">ssize_t nread</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00090">server.h:90</a></div></div>
<div class="ttc" id="server_8h_html_a2b912ed39df233b43d7a093814705afb"><div class="ttname"><a href="server_8h.html#a2b912ed39df233b43d7a093814705afb">EVER</a></div><div class="ttdeci">#define EVER</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00046">server.h:46</a></div></div>
<div class="ttc" id="sig__handler_8c_html_a4f31a6fd48ee5d4579ae4aaaa3cae285"><div class="ttname"><a href="sig__handler_8c.html#a4f31a6fd48ee5d4579ae4aaaa3cae285">sig_handler</a></div><div class="ttdeci">void sig_handler(int signo)</div><div class="ttdef"><b>Definition:</b> <a href="sig__handler_8c_source.html#l00015">sig_handler.c:15</a></div></div>
<div class="ttc" id="server_8h_html_a6821bafc3c88dfb2e433a095df9940c6"><div class="ttname"><a href="server_8h.html#a6821bafc3c88dfb2e433a095df9940c6">BUF_SIZE</a></div><div class="ttdeci">#define BUF_SIZE</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00024">server.h:24</a></div></div>
<div class="ttc" id="structt__serv_html_a71d55fd97c2ffc84c72b17820396cdff"><div class="ttname"><a href="structt__serv.html#a71d55fd97c2ffc84c72b17820396cdff">t_serv::hints</a></div><div class="ttdeci">adrinf hints</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00096">server.h:96</a></div></div>
<div class="ttc" id="server__main_8c_html_a4178685c6a99dba7611faf9fe58f1a54"><div class="ttname"><a href="server__main_8c.html#a4178685c6a99dba7611faf9fe58f1a54">evhandler</a></div><div class="ttdeci">static int evhandler(t_serv *all, int newfd)</div><div class="ttdef"><b>Definition:</b> <a href="server__main_8c_source.html#l00043">server_main.c:43</a></div></div>
<div class="ttc" id="server__init_8c_html_a1f61d16ccfab82b21ca40ce23feb7c02"><div class="ttname"><a href="server__init_8c.html#a1f61d16ccfab82b21ca40ce23feb7c02">set_sockfd</a></div><div class="ttdeci">int set_sockfd(t_serv *all)</div><div class="ttdef"><b>Definition:</b> <a href="server__init_8c_source.html#l00100">server_init.c:100</a></div></div>
<div class="ttc" id="structt__serv_html_aee509c3823199bf9f0ad285a718260bd"><div class="ttname"><a href="structt__serv.html#aee509c3823199bf9f0ad285a718260bd">t_serv::service</a></div><div class="ttdeci">char service[NI_MAXSERV]</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00093">server.h:93</a></div></div>
<div class="ttc" id="structt__serv_html_ae8783e38ef0c183366703267ca7b3298"><div class="ttname"><a href="structt__serv.html#ae8783e38ef0c183366703267ca7b3298">t_serv::res</a></div><div class="ttdeci">adrinf * res</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00095">server.h:95</a></div></div>
<div class="ttc" id="server__init_8c_html_a3802a71fa34e93cb1d85f919914f5abf"><div class="ttname"><a href="server__init_8c.html#a3802a71fa34e93cb1d85f919914f5abf">set_iface</a></div><div class="ttdeci">int set_iface(adrinf *hints, adrinf **res, const char *port)</div><div class="ttdef"><b>Definition:</b> <a href="server__init_8c_source.html#l00034">server_init.c:34</a></div></div>
<div class="ttc" id="structt__serv_html_a7659da4b3744e6ddd8f77f37d2138914"><div class="ttname"><a href="structt__serv.html#a7659da4b3744e6ddd8f77f37d2138914">t_serv::nfds</a></div><div class="ttdeci">int nfds</div><div class="ttdef"><b>Definition:</b> <a href="server_8h_source.html#l00086">server.h:86</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
